package cn.liccshop.core.utils;

import cn.liccshop.core.entity.ShopGoods;
import cn.liccshop.sys.cache.CommonCacheUtil;
import cn.liccshop.sys.constants.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;

/**
 * @author LiCC
 * @program LiCCShop
 * @description 商品信息缓存相关工具
 * @since 2019-05-22-10:38
 */
@Component
public class GoodsRedisUtil {

    @Autowired
    private CommonCacheUtil commonCacheUtil;

    /**
     * 商品热度
     * @param map
     */
    public void goodsHot(Map<String, Integer> map){
        Calendar cal = Calendar.getInstance();
        for (Map.Entry<String, Integer> goods : map.entrySet()){
            /** 更新商品库存信息 **/
            String member = goods.getKey();
            Integer value = goods.getValue();
            commonCacheUtil.caaheForGoodsOfHot(member, value);
        }
    }

    public static void main(String[] args) {
        Map<String, Integer> map= new HashMap<>();
        map.put("sdfsdfwe21321",1);
    }

}
